﻿using System;
using Coleotrack.Data.Maps;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate.Tool.hbm2ddl;

namespace Coleotrack.Service.Registration
{
    public class SqlServerConfiguration : ISqlServerConfiguration
    {
        public FluentConfiguration GetConfiguration(string connectionString, 
            ISqlServerPersistenceConfigurer sqlServerPersistenceConfigurer, 
            IExposeConfiguration exposeConfiguration,
            IMappingConfiguration mappingConfiguration)
        {
            return Fluently.Configure()
                .Database(sqlServerPersistenceConfigurer.GetPersistenceConfigurer(connectionString))
                .ExposeConfiguration(exposeConfiguration.Expose)
                .Mappings(mappingConfiguration.GetMapping);
        }
    }
}